importClass('rapi.rbase.RList');

function RContextMenu(width){	 
	this.menu=new RList(0,0,width,22);
	this.menu.isChangeClickColor=false;
	this.style=this.menu.style;
	
	this.style.border='1px solid #AAAAAA';
	this.menu.style.overflowY='auto';
	
	this.toString=function(){
		return 'RContextMenu';
	}
	this.get=function(){
		return this.menu.get();
	}
	
	this.addMenuItem=function(text,value,title){
		text='&nbsp;'+text+'';
		this.menu.addListItem(text,value,title);
		this.menu.style.height=20*this.menu.getLength()+2;
	}
	this.clear=function(){
	    this.menu.clear();
	}
	
	this.addSeparator=function(){
		this.menu.addListItem('<hr width='+(width-4)+' align="center">','','');
		this.menu.style.height=20*this.menu.getLength()+2;
	}
	
	this.addMenuContent=function(content,value,title){
		if(content.style){
			content.style.align='center';
		}
		this.menu.addListContent(content,value,title);
		this.menu.style.height=20*this.menu.getLength()+2;
	}
	
	this.setLeftTop=function(left,top){
	    this.menu.style.left=left;
		this.menu.style.top=top;
	}
	
	this.hide=function(){
		this.visible=false;
		this.menu.hide();
	}
	this.show=function(){
		this.visible=true;
		this.menu.show();
	}
	
	this.getSelectedValue=function(){
		return this.menu.selectedValue;
	}
	
	this.getSelectedIndex=function(){
		return this.menu.selectedIndex;
	}
	
	this.getSelectedText=function(){
		return this.menu.selectedText;
	}
	
	this.addListener=function(listener,estring){
		this.menu.addListener(listener,estring);
	}
}